package com.zhijian.wharf.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * mqtt消息主题枚举类
 *
 * @author HCG
 * @version 1.0
 * @date 2022/5/18
 */
@AllArgsConstructor
@Getter
public enum MqttTopicStatusEnum {

    NORMAL(0, "未发布"),
    CANCEL(1, "已发布"),;

    private Integer code;
    private String desc;

    public static MqttTopicStatusEnum getByCode(Integer code) {
        MqttTopicStatusEnum[] values = MqttTopicStatusEnum.values();
        for (MqttTopicStatusEnum anEnum : values) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        return null;
    }
}
